//模拟接口，生成api（测试用）
const Mock = require("mockjs")

const Random = Mock.Random

let Result = {
    code:200,
    msg:'success',
    data: ''
}



Mock.mock('/captcha','get',()=>{
    Result.data={
        token: Random.string(32),
        captchaImg: Random.dataImage('120x40','p7n5w')
    }
    return Result
})

Mock.mock('/login','post',()=>{
    //无法在header中传入jwt

    // Result.code = 400
    // Result.msg = "验证码错误"
     return Result
})

Mock.mock('/sys/userInfo','get',()=>{
    Result.data = {
        id : "1",
        username:"admin"
    }
    return Result
})

Mock.mock('/logout','post',()=>{
    return Result
})

Mock.mock('/sys/menu/nav','get' ,()=>{
    let nav = [{
        title :"用户数据管理",
        name :"1",
        icon :"el-icon-message-solid",
        path : "",
        component : "",
        children :[
            {
                title :"用户数据",
                name :"userData",
                icon :"el-icon-s-order",
                component : "",
                path :"/sys/userData"
            }
        ]
    },
        {
            title :"会议室数据管理",
            name :"2",
            icon :"el-icon-s-shop",
            path : "",
            component : "",
            children :[
                {
                    title :"会议室数据",
                    name :"roomData",
                    icon :"el-icon-s-opportunity",
                    component : "",
                    path :"/sys/RoomData"
                },
                {
                    title :"预约记录",
                    name :"recordedData",
                    icon :"el-icon-s-opportunity",
                    component : "",
                    path :"/sys/RecordedData"
                }
            ]
        },
        {
            title :"个人中心",
            name :"3",
            icon :"el-icon-s-shop",
            path : "",
            component : "",
            children :[
                {
                    title :"所有信息",
                    name :"adminUserCenter",
                    icon :"el-icon-s-opportunity",
                    component : "",
                    path :"/sys/AdminUserCenter"
                }
            ]
        }]
    let authoritys = []

    Result.data={
        nav:nav,
        authoritys : authoritys
    }
    return Result
})
